package com.shiyu.springssmemployeegit.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor

public class Result {
    private Integer code;
    private String message;
    private Object data;
    public static Result success(){
        Result result = new Result();
        result.setCode(200);
        result.setMessage("成功");
        return result;
    }
    public static Result success(Object data){
        Result result = new Result();
        result.setCode(200);
        result.setMessage("成功");
        result.setData(data);
        return result;
    }
    public static Result error(){
        Result result = new Result();
        result.setCode(500);
        result.setMessage("失败");
        return result;
    }
    public static Result error(Integer code,String message){
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        return result;
    }
}
